package cn.itcast.bos.web.action.base;

import java.util.List;

import javax.annotation.Resource;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;

import com.opensymphony.xwork2.ActionContext;

import cn.itcast.bos.domain.base.Courier;
import cn.itcast.bos.domain.base.TakeTime;
import cn.itcast.bos.service.base.TakeTimeService;
import cn.itcast.bos.web.action.common.BaseAction;

public class TakeTimeAction extends BaseAction<TakeTime>{
	@Resource
	private TakeTimeService service;
	@Action(value = "taketime_findall", results = { @Result(name = "success", type = "json") })
	public String findAll() {
		// 调用业务层，查询未关联的快递员
		List<TakeTime> list = service.findAll();
		ActionContext.getContext().getValueStack().push(list);
		return SUCCESS;
	}
	//分页查询收派时间
	@Action(value = "taketime_show", results = { @Result(name = "success", type = "json") })
	public String taketimeShow(){
		Pageable pageable = new PageRequest(page-1,rows);
		Page<TakeTime> pageData = service.findPage(pageable);
		pushPageDataToValueStack(pageData);
		return SUCCESS;
	}
}
